<template>
  <div class="reports">
   <el-breadcrumb separator-class="el-icon-arrow-right">
  <el-breadcrumb-item :to="{ path: '/about' }">首页</el-breadcrumb-item>
  <el-breadcrumb-item>商品管理</el-breadcrumb-item>
  <el-breadcrumb-item>商品分类</el-breadcrumb-item>
  </el-breadcrumb>

<el-card>
   <div id="main" style="width: 800px;height:400px;"></div>
</el-card>








  </div>
</template>
<script>

  import * as echarts from 'echarts';
  import _  from 'lodash'
export default {

  data() {
    return{
      datas:[],
      options: {
          title: {
            text: '用户来源'
          },
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#E9EEF3'
              }
            }
          },
          grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
          },
          xAxis: [
            {
              boundaryGap: false
            }
          ],
          yAxis: [
            {
              type: 'value'
            }
          ]
        },

    }
  },
  components:{
   
  },
  created(){
  
  },
 
 async mounted(){
    var myChart = echarts.init(document.getElementById('main'));
  
       const {data:res}=await this.$http.get('reports/type/1')
       console.log(res.data);
       this.datas=res.data.legend.data
    
// _.merge(res.data,this.options)
// var arr={...this.options,...res.data}
const resuit= Object.assign(this.options,res.data)
 myChart.setOption(resuit)

  
  }
}
</script>


<style lang="less" scoped>
.el-card{
  margin-top: 30px;
}
</style>
